#pragma once

#ifdef _WIN32
	#include <Windows.h>
#endif

class LockHelper {
private :
#ifdef _WIN32
	CRITICAL_SECTION m_oCriticalSection;
#endif
public :
	LockHelper();
	~LockHelper();
	void lock();
	void unlock();
};

LockHelper::LockHelper() {
#ifdef _WIN32
	InitializeCriticalSection(&m_oCriticalSection);
#endif
}

LockHelper::~LockHelper() {
#ifdef _WIN32
	DeleteCriticalSection(&m_oCriticalSection);
#endif
}

void LockHelper::lock() {
#ifdef _WIN32
	EnterCriticalSection(&m_oCriticalSection);
#endif
}

void LockHelper::unlock() {
#ifdef _WIN32
	LeaveCriticalSection(&m_oCriticalSection);
#endif
}